<?php

class SimpleAuth implements iAuthenticate {

    function __isAuthenticated() {
        
        return $this->secutiryRest();
        
        /**
         * Tipos de sergurança
         * type 1: TWS
         * type 2: REST
         * type 3: SERVICE
         * type 4: CLASS 
         */
        switch (Uri::getTypeSecurity()){
            case 1:
                return 'tws';
            break;
            case 2:
                return $this->secutiryRest();
            break;
            case 3:
                return 'service';
            break;
            case 4:
                return $this->securityClass();
            break;
        }
        //self::$KEY = '1aab51ab4003d10accb9166d78f1fd6cf68edb06';
        //return isset($_GET['token']) && $_GET['token'] == self::$KEY ? TRUE : FALSE;
        //return true;
    }
    
    function secutiryRest(){
        $user   = Uri::getAuthUser();
        $passw  = Uri::getAuthPw();
        $token  = Uri::getGET('token');
        
        if($user && $passw && $token){
            return true;
        }else{
            return false;
        }
    }

}
